/**
 * 智慧小区管理系统 - 物业费管理API接口
 * @author Wu.Liang
 * @date 2025-01-30
 */

import api from '@/api/request'

// 物业费相关类型定义
export interface PropertyFeeData {
  id: number
  householdId: number
  householdCode: string
  roomNumber: string
  communityId: number
  communityName: string
  buildingId: number
  buildingName: string
  unitId: number
  unitName: string
  billingPeriod: string
  amount: number
  paymentStatus: number
  paymentStatusName: string
  dueDate: string
  paidDate?: string
  createTime: string
  updateTime: string
}

// 物业费管理API
export const propertyFeeApi = {
  // 获取物业费分页列表
  getPropertyFeePage(params?: any) {
    return api.get('/api/property/property-fees', { params })
  },

  // 获取物业费详情
  getPropertyFeeDetail(id: number) {
    return api.get(`/api/property/property-fees/${id}`)
  },

  // 新增物业费
  addPropertyFee(data: any) {
    return api.post('/api/property/property-fees', data)
  },

  // 更新物业费
  updatePropertyFee(id: number, data: any) {
    return api.put(`/api/property/property-fees/${id}`, data)
  },

  // 删除物业费
  deletePropertyFee(id: number) {
    return api.delete(`/api/property/property-fees/${id}`)
  },

  // 批量生成物业费
  batchGeneratePropertyFees(data: any) {
    return api.post('/api/property/property-fees/batch-generate', data)
  },

  // 批量更新物业费状态
  batchUpdatePropertyFeeStatus(data: any) {
    return api.put('/api/property/property-fees/batch-status', data)
  },

  // 获取物业费统计信息
  getPropertyFeeStatistics(params: any) {
    return api.get('/api/property/property-fees/statistics', { params })
  },

  // ==================== 房户详情Tab页接口 ====================

  // 获取房户物业费列表
  getHouseholdPropertyFees(householdId: number, current: number = 1, size: number = 10) {
    return api.get(`/api/property/property-fees/household/${householdId}`, {
      params: { current, size }
    })
  }
}

export default propertyFeeApi
